import Vue from "vue";
import VueRouter from "vue-router";

import View404 from "@/components/404View.vue";
import LoginView from "@/views/LoginView.vue";
import AbView from "@/views/AbView.vue";
import AdView from "@/views/AdView.vue";
import WxChat from "@/views/WxChat.vue";
import RegisterView from "@/views/RegisterView.vue";
import LayoutView from "@/components/LayoutView.vue";

Vue.use(VueRouter);

const routes = [{
    path: '/login',
    component: LoginView,
}, {
    path: '/register',
    component: RegisterView,
}, {
    path: '/',
    component: LayoutView,
    children: [{
        path: '/w',
        name: 'W',
        component: WxChat,
    }, {
        path: '/d',
        name: 'D',
        component: AdView,
    }, {
        path: '/b',
        name: 'B',
        component: AbView,
    },],
}, {
    path: '*',
    name: '404',
    component: View404,
}];

const router = new VueRouter({
    mode: 'hash', // hash history 区别：hash模式下url会带#号，history模式下不会带#号
    base: process.env.BASE_URL,
    routes,
});

export {
    router,
    routes
};